(function () {
	nsbase.views.incomeLayout = new IncomeLayoutFunc();

	function IncomeLayoutFunc () {
		var self = this;

		self.init = _init;


		function _init () {
			initMenuBar();
		}

		function initMenuBar () {
			var $menuBar = $('#menuBar');

			var cssClass = {
				closed:'closed',
				selected:'selected'
			};

			$menuBar.find('dl').click(function() {
				var $sender = $(this);
				var hasSelected = $sender.find('.' + cssClass.selected).length > 0;
				if($sender.hasClass(cssClass.closed)){
					$sender.removeClass(cssClass.closed);
					$sender.removeClass(cssClass.selected);
				} else {
					$sender.addClass(cssClass.closed);
					if (hasSelected) $sender.addClass(cssClass.selected);
				}
			});
		}

	}
})();